import re
import requests
import json


content = 'Hello 123 4567 World_T his is a Regex Demo'
print (len(content))
result = re.match('^Hello\s\d\d\d\s\d{4}\s\w{10}', content)
print (result)


result2 = re.match('^Hello.*Demo$',content)
print (result2.group())
print (result2.span())

comtents = 'Hello 1234567 World_This is a Regex Demo'
result4 = re.match('He.*(\d+).*Demo',content)
print (result4)
print (result4.group())

response = requests.get("https://www.baidu.com")
print (response.status_code)
print (response.reason)
for name, value in response.headers.item():
    print ("%s:%s"%(name, value))
print (response.content)

post = requests.post("https://jianshu.com",data = {'key':'value'})
put = requests.put("https://jianshu.com",data = {'key':'value'})
get = requests.get("https://jianshu.com",data = {'key':'value'})
delete = requests.delete("https://jianshu.com",data = {'key':'value'})

args = {'p':4,'s':20}
responses = requests.get("http://fav.foofish.net",params=args)
print (responses.url)

url = 'http://jianshu.com'
payload = {'key':'value'}
resf = requests.post(url, json=payload)

session = requests.Session()
session.post(login_url,data={username,password})
ref = session.get(home_url)
session.close()


class Employee:
    '所有员工的基类'
    empCount = 0

    def __init__(self, name, salary):
        self.name = name
        self.salary = salary
        Employee.empCount += 1

    def displayCount(self):
        print "Total Employee %d" % Employee.empCount

    def displayEmployee(self):
        print "Name : ", self.name, ", Salary: ", self.salary


print "Employee.__doc__:", Employee.__doc__
print "Employee.__name__:", Employee.__name__
print "Employee.__module__:", Employee.__module__
print "Employee.__bases__:", Employee.__bases__
print "Employee.__dict__:", Employee.__dict__
